package com.example.demo.controller;

import com.example.demo.domain.Product;
import com.example.demo.service.ProductService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class ProductController {
    @Resource
    private ProductService productService;

    @GetMapping("/queryProducts")
    public void queryProducts() {
        String table = "demo.demoapp_publish";
        String select = "name,city";
        String where = "id=#{bom}";
        List<Map<String, String>> data = new ArrayList<>();
        Map<String, String> data1 = new HashMap<>();
        data1.put("bom", "1");
        data.add(data1);
        productService.getConnectionExample(table, select, where, data);
        List<Product> products = productService.queryProducts(table, select, where, data);

        products.forEach(System.out::println);

    }
}